#include("common.html")
<html lang="en">
  
  <head>
    <meta charset="utf-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>商城</title>
    <meta name="description" content="商城">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="full-screen" content="yes">
    <meta name="x5-fullscreen" content="true">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="#(tpath)/static/css/element.css">
    <link rel="stylesheet" type="text/css" href="#(tpath)/static/css/basic.css">
    <link rel="stylesheet" type="text/css" href="#(tpath)/static/css/filter.css">
    <link rel="stylesheet" type="text/css" href="#(tpath)/static/swiper/swiper.min.css">
    <link rel="stylesheet" type="text/css" href="#(tpath)/static/show/common.css">
    <script src="#(tpath)/static/js/jquery.js"></script>
	<script src="#(tpath)/static/swiper/swiper.min.js"></script>
    <script src="#(tpath)/static/show/common.js"></script>
    <style type="text/css">
    .van-icon-like{
    	color: rgb(245, 108, 108);
    }
    .van-icon-like-o{
    	color: rgb(153, 153, 153);
    }
    </style>
  </head>
  
  <body class="">
	#include("header.html")
    <style type="text/css">#detail{ background-color: #f6f6f6; } .allwarp .breadcrumbs { clear: both; height: 44px; line-height: 44px; color: #999; width: 1200px; margin: 0 auto; } .allwarp .clearfix { zoom: 1; } .allwarp .breadcrumbs li { float: left; font-size: 12px; } .allwarp .breadcrumbs a, .breadcrumbs a:visited { color: #737574; } .pro_maincontent { min-height: 635px; padding-bottom: 120px; } .pro_right_goods { float: right; width: 16%; margin-left: 1%; } .allwarp .col-aside .mod { background-color: #fff; } .allwarp .col-aside .mod .hd { height: 36px; line-height: 36px; /* padding: 0 14px; */ border-bottom: 1px solid #ddd; font-size: 14px; font-weight: 400; background-color: #fff; text-align: center; } .list-item { padding-bottom: 17px; border-bottom: 1px solid #eee; font-size: 12px; overflow: hidden; float: none; width: 196px; height: 184px; } .allwarp .col-aside .mod-hotsale .pic { margin: 20px auto 6px; text-align: center; position: relative; width: 100px; height: 100px; overflow: hidden; } .allwarp .col-aside .mod-hotsale .pic, .col-aside .mod-hotsale .name { display: block; } .allwarp .col-aside .mod-hotsale .pic img { max-width: 100px; max-height: 100px; } .allwarp .col-aside .mod-hotsale .name { margin-bottom: 6px; color: #666; -webkit-line-clamp: 2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; text-align: center; } .allwarp .col-aside .mod-hotsale .price { color: #333; display: block; text-align: center; } .red { color: #e58277 !important; } .allwarp .col-aside .mod .mod-list:after { content: '\20'; display: block; height: 0; clear: both; } .allwarp .col-aside .mod .ft { height: 40px; text-align: center; } .allwarp .col-aside .ui-slider-prev { background-position: -88px 8px !important; } .allwarp .col-aside .ui-slider-prev, .col-aside .ui-slider-next { display: inline-block; width: 22px; height: 32px; vertical-align: middle; background: url(/static/pc/imgs/arrow.png) no-repeat; } .allwarp .col-aside .mod .ft .gap { -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=-1, M12=1.224646798818428e-16, M21=-1.224646798818428e-16, M22=-1, SizingMethod='auto expand')"; filter: progid:DXImageTransform.Microsoft.Matrix(M11=-1, M12=1.224646798818428e-16, M21=-1.224646798818428e-16, M22=-1, SizingMethod='auto expand'); -ms-transform: rotate(-45deg); padding: 16px; } .allwarp .col-aside .ui-slider-next { background-position: -65px 8px; } .pro_maincontentleft { width: 83%; margin-bottom: 50px; } .pro_maincontentleft_top { min-height: 520px; background: #fff; padding-bottom: 10px; } .pro_maincontentleft .pro_img_box { width: 37%; margin: 1%; } .pro_maincontentleft .pro_img_box .pro_img_zoom { width: 350px; height: 350px; margin: 0 auto; } .pro_maincontentleft .pro_img_box .pro_img_zoom img { width: 100%; height: 100%; } .pro_maincontentleft .pro_img_box .pro_img_more { width: 350px; height: 78px; margin-top: 9px; margin-left: 0px; } .pro_img_more a.prev, .pro_img_more a.next { color: #666; } .pro_img_more .prev { float: left; margin-right: 4px; } .pro_img_more .prev, .pro_img_more .next { display: block; text-align: center; width: 10px; height: 65px; line-height: 65px; border: 1px solid #eee; background: #f5f5f5; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: bold; } .pro_img_more a.prev, .pro_img_more a.next { color: #666; } .pro_img_more .next { float: right; } .pro_img_more .prev, .pro_img_more .next { display: block; text-align: center; width: 10px; height: 65px; line-height: 65px; border: 1px solid #eee; background: #f5f5f5; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: bold; } .pro_maincontentleft .pro_img_box .pro_img_moreul { float: left; position: relative; width: 93%; height: 68px; overflow: hidden; /* margin-left: 6px; */ } .pro_maincontentleft .pro_img_box .pro_img_moreul ul { position: absolute; width: 999999px; height: 68px; } .pro_maincontentleft .pro_img_box .pro_img_more li { width: 64px; height: 64px; margin-right: 2px; float: left; text-align: center; line-height: 64px; border: 1px #eeeeee solid; } .pro_img_moreul img { max-width: 55px; max-height: 55px; vertical-align: middle; } .pro_maincontentleft .pro_img_box .share_col { color: #999999; font-size: 12px; float: left; } .pro_maincontentleft .pro_infor { width: 59%; margin-left: 1%; position: relative; } .pro_infor .pro_title { font-size: 24px; color: #333333; font-family: \5fae\8f6f\96c5\9ed1, simsun; line-height: 30px; margin-top: 20px; } .pro_infor .tag{ margin-right: 5px; color:#fff; } .all_warp { padding:9px 0; color: #666; border-bottom: 1px dotted #e7e7e7; } .sale_price_bg { width: 100%; background: #F9F9F9; border-top: 1px #eee solid; /*padding: 2px 0px;*/ } .all_warp .sale_price_het { height: 45px; line-height: 45px; } .sale_price { /*padding: 4px 0;*/ font-size: 14px; display: flex; } .sweep_tobuy_box { float: right; margin-right: 10px; position: relative; } .sale_price .promotion_price { vertical-align: 5px; color: #387bd2; font-size: 12px; margin-left: 5px; cursor: pointer; } .sweep_tobuy { display: inline-block; vertical-align: middle; cursor: pointer; width: 29px; height: 28px; font-size: 0; line-height: 0; background: url(/static/pc/imgs/wechat.jpg) no-repeat; } .sweep_tobuy_code { display: none; position: absolute; right: 0px; z-index: 1; top: 35px; padding: 0px; border: 1px solid #d5d5d5; background-color: #fff; text-align: center; } .sweep_tobuy_code img { vertical-align: middle; width: 116px; height: 116px; } .price_title { color: #f15151; font-weight: bold; font-size: 16px; } .sale_price .sale_price_title, .sale_price .tariff_t { display: inline-block; color: #666666; vertical-align: 5px; padding-left: 10px; font-size: 14px; } .sale_price .price { color: #f15151; font-size: 26px; font-weight: 600; vertical-align: baseline; } .sale_price #original_price { font-size: 12px; color: #999999; vertical-align: 5px; margin-left: 5px; text-decoration: line-through; } .sale_price .refrence_price { font-size: 14px; color: #999999; margin-left: 10px; margin-top: 10px; margin-bottom: 10px; } .sale_price .specs { color: #666; font-size: 14px; vertical-align: 5px; margin-left: 5px; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; } .sale_price .num_stock { display: inline-block; vertical-align: 5px; margin-left: 5px; } .sale_price .num { float: left; margin-right: -1px; * margin-left: 0px !important; } .sale_price #store_minus { display: block; width: 24px; height: 30px; background: url(/static/pc/imgs/leftss.png); float: left; cursor: pointer; } .num_stock input { width: 26px; height: 26px; vertical-align: inherit; text-align: center; } .sale_price #store_plus { display: block; width: 24px; height: 30px; background: url(/static/pc/imgs/rightss.png); float: left; cursor: pointer; margin-left: 1px; } .sale_price input.pdetail_addcart { background: #f15151; color: #fff; padding: 8px 25px; border: none; margin-right: 5px; cursor: pointer; font-size: 18px; border-radius:
      2px; } .allwarp .goodsbottom .gbt_left { /* height: 100%; */ background: #fff; margin-top: 10px; } .allwarp .goodsbottom .gbt_left .title { height: 40px; margin: 0 auto; background: #fff; border-bottom: 1px #eee solid; border-top: 1px #eee solid; } .allwarp .goodsbottom .gbt_left .title .dis { border-top: 2px #d23934 solid; background: #fff; border-left: 1px #eee solid; border-right: 1px #eee solid; height: 39px; line-height: 35px; margin-top: 0px; } .allwarp .goodsbottom .gbt_left .title a { float: left; padding: 0 50px; text-align: center; height: 40px; line-height: 40px; font-size: 14px; color: #555; } .pro_maincontentleft .pro_img_box .share_col a { color: #999999; } /*.share_col .icol { padding-left: 30px; background: url(/static/pc/imgs/col.jpg) no-repeat 15px center; }*/ .allwarp .goodsbottom .gbt_left .usershow_cont { padding: 20px; } .allwarp .goodsbottom .gbt_left .usershow_cont { padding: 20px 100px 40px; } .allwarp .goodsbottom .gbt_left .usershow_cont .show { display: block; } .sweep_tobuy:hover + .sweep_tobuy_code{ display: block; } .introduce{ overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } .el-radio-button__inner{ border-radius: 4px !important; border: 1px solid #DCDFE6; margin: 5px; } .all_warp2{ color: #666; border-bottom: 1px dotted #e7e7e7; } .el-tabs__header{ margin: 0px; } .goods_no_desc{ padding:50px 0px; background-color: #fff; text-align: center; font-size: 14px; } .goods_desc{ padding: 20px; box-sizing: border-box; width: 720px; } .goods_desc img { max-width: 900px; vertical-align: middle; } .pro_infor .pro_brief_intro { font-size: 12px; /* line-height: 18px; */ color: #999; padding-bottom: 0px; /* border-bottom: 1px #eee solid; */ margin-bottom: 8px; margin-top: 5px; letter-spacing: 0px; overflow:hidden; text-overflow:ellipsis; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; } .el-dialog--center .el-dialog__body{ text-align: center; } .hot-content{ visibility: visible; overflow: hidden; position: relative; z-index: 2; left: 0px; height: 606px; width: 100%; } .el-input-number{ width: 130px; } .share-bt{ margin-top: 20px; text-align: right; } .message-img{ margin-left: 50px; margin-right: 100px; float: left; } .message-hint{ font-size: 30px; color: #b82831; } .message-goods{ line-height: 30px; color: #6d6d6d; font-size: 14px; } .message-a{ line-height: 30px; font-size: 14px; } .message-a:hover{ color: #6d6d6d; } a{ outline: none; cursor: pointer; color: #428bca; } .cart-thead{ display: block; padding: 45px 0; background: #fff; border: 1px solid #e9e9e9; } .share_hint{ background-color: #faf1dc; font-size: 12px; padding: 7px 12px; box-sizing: border-box; color: #666; margin-bottom: 10px; cursor: pointer; } .el-icon-arrow-right{ float: right; margin-top: 3px; color: #666; } .goods-stock{ position: absolute; width: 100px; height: 100px; opacity: 0.5; background-color: #000; left: 0px; top: 0px; text-align: center; color: #fff; line-height: 100px; font-size: 20px; font-weight: 600; } .add_show .el-dialog__header{ padding: 10px 20px; background-color: #f8f8f8; } .add_show .el-dialog__title{ font-size: 16px; } .add_show .el-dialog__body{ color: #303133; padding: 10px; } .add_show .el-dialog__footer{ text-align: center; padding: 0px 20px 20px; } .add_show .el-button{ padding: 10px 15px; } .add_cart{ background-color: #2f8ded; color: #fff; } .add_cart:hover{ background-color: #2f8ded; color: #fff; } .submit_bt{ color: #303133; background-color: #f1f1f1; border-color: #f1f1f1; } .submit_bt:hover{ color: #303133; background-color: #f1f1f1; border-color: #f1f1f1; } .img_code{ font-size: 12px; text-align: center; border: 1px #d0d0d0 solid; padding: 0px 10px 10px; width: 120px; box-sizing: border-box; background-color: #fff; } .el-link{ font-size: 12px; margin-right: 30px; } .seckill_time{ background-color: #F56C6C; color: #fff; padding: 10px 20px; font-size: 14px; } .goods-desc{ font-size: 14px; color: #999; margin-top: 5px; margin-bottom: 10px; -webkit-line-clamp: 2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; } .memberPhoto{width:40px;height:40px;border-radius:50px;border:1px solid #f8f8f8;} .memberName{font-size:14px;color:#333333;} .goodsSpec{font-size:14px;color:#999999;} .goodsEvaluate{font-size:14px;color:#333333;} .evaluateImg{margin-top:10px;} .evaluateImg img{margin-right:5px;width:100px;height:100px;border-radius:5px;} .marginTop{margin-top:20px;} .old_price{ font-weight: normal; text-decoration: line-through; font-size: 12px; color: #999; }</style>
    <div id="detail">
      <div class="product_detail_warp">
        <div class="allwarp">
          <div class="breadcrumbs">
            <ul class="clearfix">
              <li class="home">
                <a href="#" title="首页">首页</a>
                <span>&nbsp;&nbsp;&gt;&nbsp;&nbsp;</span></li>
              <li class="home">
                <a href="#">#(product.name)</a>
                <span></span>
              </li>
              <div class="cl"></div>
            </ul>
          </div>
        </div>
        <div class="allwarp">
          <div id="pro_maincontent" class="pro_maincontent">
            <div class="pro_right_goods">
              <div id="hotsaide" otop="225" class="col-aside">
                <div class="mod mod-hotsale" style="height: 643px;">
                  <h3 class="hd">热销商品</h3>
                  <div class="hot-content" style="visibility: visible; overflow: hidden; position: relative; z-index: 2; left: 0px; height: 606px;">
                    <ul style="margin: 0px; padding: 0px; position: relative; list-style: none; z-index: 1; height: 606px;">
                      <!-- list start -->
                      #product_list(count=3,orderBy="sales desc")
             		  #for(product : products)
                      <li class="list-item" style="overflow: hidden; float: none; width: 196px; height: 184px;" onclick="location.href='#(product.path)'">
                        <a class="pic">
                          <!---->
                          <img src="#(imageUrl(product.image))" width="100" height="100"></a>
                        <a href="#(product.path)" class="name">#(product.name)</a>
                        <span class="price red">促销：￥#(product.price)</span></li>
                      	#end
                      	#end
                      <!-- list end -->
                    </ul>
                  </div>
                  <!-- <div id="search_rhot_btn" class="ft">
                    <a class="ui-slider-prev"></a>
                    <span class="gap"></span>
                    <a class="ui-slider-next"></a>
                  </div> -->
                </div>
              </div>
            </div>
            <div class="pro_maincontentleft fl">
              <input type="hidden" id="productId" value="#(product.id)">
              <div class="pro_maincontentleft_top">
                <div class="pro_img_box fl">
                  <div class="pro_img_zoom jqzoom" style="cursor: crosshair; position: relative;" id="showbox">
                  						#for(productImage : product.productImages)
                                        <img src="#(imageUrl(productImage))" width="350" height="350">
                                        #end
                                    </div>
                  <div class="pro_img_more showpage">
                      <a href="#" class="prev" id="showlast"><</a>
                      <a href="#" class="next" id="shownext">></a>
                      <div class="swiper-container">
                          <ul class="swiper-wrapper" id="showsum">
                          </ul>
                      </div>
                  </div>
                  <div class="cl"></div>
                  <div class="share_col">
                    <a href="#" class="icol add_fav">
                      <i class="el-icon-star-off #if(isFav) van-icon-like #else van-icon-like-o #end"  id="favProduct" productId="#(product.id)"></i>收藏商品</a>
                    <span>(#(product.hits??'0')人气)</span></div>
                  <!-- <a class="el-link el-link--primary is-underline" style="float: right;">
                   
                    <span class="el-link--inner">分享图片</span>
                   </a> -->
                  <div class="cl"></div>
                </div>
                <div class="pro_infor fl">
                  <h1 class="pro_title">
                    <!---->
                    <span class="tag el-tag el-tag--small" style="background-color: rgb(230, 162, 60);" effect="dark">#(product.shipArea)</span>
                    <!---->#(product.name)</h1>
                  <div class="cl"></div>
                  <div class="goods-desc">#(product.weight)</div>
                  <div class="goods-desc" style="color: red;">#if(product.isGroup) 已团:#(product.groupProduct.currentNum??"0")人 &nbsp;&nbsp; #(product.groupProduct.num)人团#end</div>
                  <!---->
                  <!---->
                  <div class="seckill_pro1"></div>
                  <div class="all_warp2">
                    <div class="sale_price_bg">
                      <div class="sale_price sale_price_het"  style="height: 129px;">
                        <div style="flex: 1 1 0%;">
                         <div>
						  <div class="sale_price_title price_title">
						    <span>售价：</span>
						    <span class="price">￥#(product.realPrice)</span>
						    <!----></div>
						</div>
                          </div>
                      </div>
                    </div>
                  </div>
                  <div class="all_warp">
                    <div class="sale_price">
                      <div class="tariff_t">品牌：
                        <a href="#(product.brand.path)">#(product.brand.name)</a></div>
                    </div>
                  </div>
                  <!---->
                  <div class="sale_price all_warp" style="padding-left: 10px;">
                    <div style="flex: 1 1 0%;">数量：
                      <div class="el-input-number">
                        <span role="button" class="el-input-number__decrease is-disabled">
                          <i class="el-icon-minus" style="line-height: 38px;"></i></span>
                        <span role="button" class="el-input-number__increase #if(product.stock==0 || product.stock==1 || product.isGroup || product.isSeckill) is-disabled #end">
                          <i class="el-icon-plus" style="line-height: 38px;"></i>
                        </span>
                        <div class="el-input">
                          <!---->
                          <input type="text" autocomplete="off" class="el-input__inner" #if(product.stock==0) value="0" #else value="1" #end id="number" stock="#(product.stock)" #if(product.isGroup || product.isSeckill) disabled #end>
                          <!---->
                          <!---->
                          <!---->
                          <!----></div>
                      </div>
                    </div>
                    <!----></div>
                  <div class="all_warp">
                    <div class="sale_price" style="display: flex;">
                      <div style="flex: 1 1 0%;">
                        <div class="tariff_t">毛重：#(product.weight)</div></div>
                      <div style="flex: 1 1 0%;">
                        <div class="tariff_t">有效期：无</div></div>
                      <div style="flex: 1 1 0%;">
                        <div class="tariff_t">发货地：无</div>
                        <!----></div>
                    </div>
                  </div>
                  <div class="sale_price">
                    <div class="share-bt">
                      #if(product.isGroup)
                      #if(product.groupProduct.isCompleted)
                      <button class="el-button el-button--warning"  disabled>
                        <span class="van-button__text">拼团已完成</span></button>
                      #else
                      <button type="button" class="el-button el-button--danger" id="buyBtn" val="GROUP_BUY">
                        <!---->
                        <!---->
                        <span>一键拼团</span></button>
                      #end
                      #else if(product.isSeckill)
                      <button type="button" class="el-button el-button--danger" id="buyBtn" val="SECKILL_BUY">
                        <!---->
                        <!---->
                        <span>一键秒杀</span></button>
                      #else
                      <button type="button" class="el-button el-button--danger" id="buyBtn" val="NOW_BUY">
                        <!---->
                        <!---->
                        <span>立即购买</span></button>
                      <button type="button" class="el-button el-button--danger" id="addCartBtn">
                        <!---->
                        <!---->
                        <span>加入购物车</span></button>
                      #end
                    </div>
                  </div>
                  <div class="cl"></div>
                </div>
                <div class="cl"></div>
              </div>
              <div class="goodsbottom">
                <div class="gbt_left">
                  <div class="el-tabs el-tabs--card el-tabs--top">
                    <div class="el-tabs__header is-top">
                      <div class="el-tabs__nav-wrap is-top">
                        <div class="el-tabs__nav-scroll">
                          <div role="tablist" class="el-tabs__nav is-top" style="transform: translateX(0px);">
                            <div id="tab-1" aria-controls="pane-1" role="tab" aria-selected="true" tabindex="0" class="el-tabs__item is-top is-active">商品详情</div>
                            <!-- <div id="tab-2" aria-controls="pane-2" role="tab" tabindex="-1" class="el-tabs__item is-top">商品评价</div></div> -->
                        </div>
                      </div>
                    </div>
                    <div class="el-tabs__content">
                      <div role="tabpanel" id="pane-1" aria-labelledby="tab-1" class="el-tab-pane">
                        <div class="goods_no_desc">#(product.introduction)</div></div>
                      <!---->
                      <div role="tabpanel" aria-hidden="true" id="pane-2" aria-labelledby="tab-2" class="el-tab-pane" style="display: none;">
                        <div class="goods_no_desc">---暂无商品评价信息---</div></div>
                    </div>
                  </div>
                </div>
                <div class="cl"></div>
              </div>
            </div>
          </div>
          <div class="cl"></div>
        </div>
      </div>
      <div class="cl"></div>
      <!-- 添加购物车弹框 -->
      <div class="v-modal" tabindex="0" id="addCartModal" style="display: none;z-index: 2004;"></div>
      <div class="el-dialog__wrapper add_show" style="display: none;z-index: 2005;" id="addCartDiv">
        <div role="dialog" aria-modal="true" aria-label="添加购物车成功:" class="el-dialog" style="margin-top: 15vh; width: 22%;">
          <div class="el-dialog__header">
            <span class="el-dialog__title">添加购物车成功:</span>
            <!----></div>
          <!---->
          <div class="el-dialog__footer">
            <div class="dialog-footer">
              <button type="button" class="el-button add_cart el-button--default" id="continueBuy">
                <!---->
                <!---->
                <span>继续购物</span></button>
              <button type="button" class="el-button submit_bt el-button--primary" onclick="location.href='#(base)/cart/list'">
                <!---->
                <!---->
                <span>去购物车结算</span></button>
            </div>
          </div>
        </div>
      </div>
    </div>
	#include("footer.html")
  </body>
</html>
<script type="text/javascript">
  $(document).ready(function(){
	  var showproduct = {
		  "boxid":"showbox",
		  "sumid":"showsum",
		  "boxw":350,//宽度,该版本中请把宽高填写成一样
		  "boxh":350,//高度,该版本中请把宽高填写成一样
		  "sumw":60,//列表每个宽度,该版本中请把宽高填写成一样
		  "sumh":60,//列表每个高度,该版本中请把宽高填写成一样
		  "sumi":7,//列表间隔
		  "sums":5,//列表显示个数
		  "sumsel":"sel",
		  "sumborder":1,//列表边框，没有边框填写0，边框在css中修改
		  "lastid":"showlast",
		  "nextid":"shownext"
		  };//参数定义	  
	 $.ljsGlasses.pcGlasses(showproduct);//方法调用，务必在加载完后执行
  });
</script>
<script type="text/javascript">
$("#favProduct").on("click",function(){
	var productId = $(this).attr("productId");
	$.ajax({
        url: "#(base)/product_fav/save",
        type: "post",
        data: {"productId":productId},
        dataType: "json",
        success: function(res){
        	if(res.type=="success"){
        		if($("#favProduct").hasClass("van-icon-like")){
        			$("#favProduct").removeClass("van-icon-like");
        			$("#favProduct").addClass("van-icon-like-o");
	        		alert("取消收藏成功");
        		}else{
        			$("#favProduct").removeClass("van-icon-like-o");
        			$("#favProduct").addClass("van-icon-like");
	        		alert("收藏成功");
        		}
        	}else{
        		alert(res.msg);
        	}
        },
        error: function(res){
        }
    });
});

$(".el-input-number__decrease").on("click",function(){
	var number = parseInt($("#number").val());
	if(number<=1){
		return;
	}
	number = number-1;
	$("#number").val(number);
	if(number<=1){
		$(this).addClass("is-disabled");
	}
	$(".el-input-number__increase").removeClass("is-disabled");
});

$(".el-input-number__increase").on("click",function(){
	var number = parseInt($("#number").val());
	var stock = parseInt($("#number").attr("stock"));
	if(number>=stock){
		alert("库存不足");
		return;
	}
	number = number+1;
	$("#number").val(number);
	if(number>=stock){
		$(".el-input-number__increase").addClass("is-disabled");
	}
	$(".el-input-number__decrease").removeClass("is-disabled");
});

$("#number").on("blur",function(){
	
	var number = parseInt($("#number").val());
	var stock = parseInt($("#number").attr("stock"));
	if(number>=stock){
		$("#number").val(stock);
		$(".el-input-number__increase").addClass("is-disabled");
	}
	if(parseInt($("#number").val())>1){
		$(".el-input-number__decrease").removeClass("is-disabled");
	}
	});


$("#addCartBtn").on("click",function(){
	var productId = $("#productId").val();
	var quantity = $("#number").val();
	updateQuantity(productId,quantity);
});

$("#buyBtn").on("click",function(){
	var productId = $("#productId").val();
	var quantity = $("#number").val();
	var orderType = $(this).attr("val");
	if(quantity<1){
		alert("库存不足");
		return;
	}
	location.href="#(base)/order/add?productId="+productId+"&quantity="+quantity+"&orderType="+orderType;
});

//更新购物车数量
function updateQuantity(productId,quantity){
	$.ajax({
        url: "#(base)/cart_item/update",
        type: "post",
        data: {"productId":productId,"quantity":quantity},
        dataType: "json",
        success: function(res){
        	if(res.type=="warn"){
        		alert(res.msg);
        		location.href="#(base)/login";
        	}else{
        		$("#addCartModal").show();
        		$("#addCartDiv").show();
	        	var quantity = res.quantity;
        	}
        },
        error: function(res){
        }
    });
}

$("#continueBuy").on("click",function(){
	$("#addCartModal").hide();
	$("#addCartDiv").hide();
});
</script>
